<script lang="ts" setup>
import { inject } from 'vue'
import MenuView from '@/views/home/MenuView.vue'
import ContentView from '@/views/home/ContentView.vue'

const member = JSON.parse(sessionStorage.getItem('member'))
const api = inject('api')
const memberApi = api.getApi('FaSysMember')
// 退出登录
function logout() {
  memberApi.logout()
}
</script>

<template>
  <div class="common-layout" style="height: 100vh; width: 100%">
    <el-container style="height: 100%">
      <!-- <el-progress :percentage="100" /> -->
      <el-header class="header box-shadow">
        <el-avatar
            shape="square"
            src="https://img2.baidu.com/it/u=462483877,345843050&fm=253&fmt=auto&app=138&f=JPEG?w=450&h=450"
        />
        <div style="flex: 1; margin-left: 10px">
          <el-text>{{ member.note }}</el-text
          ><br />
          <el-text size="small">{{ member.account }}</el-text>
          <el-text size="small" style="margin-left: 20px">Last ip: {{ member.lastIp }}</el-text>
        </div>
        <el-dropdown>
          <el-icon style="cursor: pointer" size="20"><Tools /></el-icon>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item>更新日志</el-dropdown-item>
              <el-dropdown-item>v 1.0.0</el-dropdown-item>
              <el-dropdown-item>关于我们</el-dropdown-item>
              <el-dropdown-item @click="logout" divided>退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </el-header>
      <el-container style="height: 95vh">
        <el-aside class="aside box-shadow" width="auto">
          <el-scrollbar height="91vh"> <MenuView></MenuView> </el-scrollbar>
        </el-aside>
        <el-main class="main" width="auto">
          <ContentView />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<style scoped>
.box-shadow {
  box-shadow: 5px 5px 10px 0 rgba(0, 0, 0, 0.5);
}
.header {
  /* height: 5vh; */
  background-color: rgb(241, 241, 241);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.aside {
  background-color: rgb(220 216 216 / 27%);
  /* padding-top: 20px; */
}
.main {
  /* height: 95vh; */
  background-color: rgb(169 169 169 / 27%);
}
/**隐藏顶部进度条尾部文字内容 */
:deep(.el-progress__text) {
  display: none;
}
</style>
